home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
T
/
TC Prog Guide.cpt
/
picture ƒ
/
pict.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-02-26
|
2KB
|
72 lines
/*
* FILE: pict.c
* AUTHOR: R. Gonzalez
* CREATED: November 7, 1990
*
* generic pict application methods. You should define a single
* object of a class descending from Generic_Pict in your application,
* and your main() function should simply send this object init(),
* run(), and destroy() messages.
*/
# include "pict.h"
# include "error.h"
Error *gerror; /* global to report errors */
/******************************************************************
* initialize - be sure to call inherited method first when
* overriding
******************************************************************/
boolean Generic_Pict::init(void)
{
double aspect;
gerror = new(Error);
gerror->init();
# ifdef THINK_C
screen = new(Mac_Screen);
# else
screen = new(PC_Screen);
# endif
screen->init();
/* screen->init() should do this, but just to be sure: */
aspect = screen->get_device_aspect_ratio();
screen->set_normalized_frame(0.,0.,2.,2./aspect);
backdrop = new(Backdrop_Projector);
backdrop->init();
backdrop->set_screen(screen);
return TRUE;
}
/******************************************************************
* run - override freely
******************************************************************/
void Generic_Pict::run(void)
{
screen->wait();
}
/******************************************************************
* destroy - be sure to call inherited method after overriding
******************************************************************/
boolean Generic_Pict::destroy(void)
{
backdrop->destroy();
delete(backdrop);
screen->destroy();
delete(screen);
gerror->destroy();
delete(gerror);
return TRUE;
}